package com.sv.service;

import java.sql.SQLException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sv.dao.SdContentChannelDAOImpl;
import com.sv.dao.SdContentDAOImpl;
import com.sv.dao.SdContentExtDAOImpl;
import com.sv.model.SdContent;
import com.sv.model.SdContentChannelCriteria;
import com.sv.model.SdContentChannel;
import com.sv.model.SdContentExt;

@Service
public class SdContentService {

    @Autowired
    private SdContentDAOImpl sdContentDaoImpl;
    @Autowired
    private SdContentChannelDAOImpl sdContentChannelDAOImpl;
    @Autowired
    private SdContentExtDAOImpl sdContentExtDAOImpl;
    
    public SdContent selectSdContentById(int id) throws SQLException {
        return sdContentDaoImpl.selectByPrimaryKey(1);
    }
    
    public SdContentChannel selectSdContentChannel(int contentId) throws SQLException{
        SdContentChannelCriteria criteria = new SdContentChannelCriteria();
        criteria.createCriteria().andContentIdEqualTo(contentId);
        
        return (SdContentChannel)sdContentChannelDAOImpl.selectByExample(criteria).get(0);
    }
    
    public SdContentExt selectContentExt(int contentId) throws SQLException{
        return sdContentExtDAOImpl.selectByPrimaryKey(contentId);
        
    }
}
